Skip to content

Move pending payment tracking to after the new HTLC flies #1109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

TheBlueMatt
Copy link
Collaborator

If we attempt to send a payment, but the HTLC cannot be send due to
local channel limits, we'll provide the user an error but end up
with an entry in our pending payment map. This will result in a
memory leak as we'll never reclaim the pending payment map entry.

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@TheBlueMatt TheBlueMatt force-pushed the 2021-10-init-fail-payment-retry-leak branch from 2de839e to 34e2ad5 Compare October 5, 2021 22:33
@TheBlueMatt
Copy link
Collaborator Author

Caught another super minor issue and pushed a trivial fix, also fixed build on older rustc.

@codecov
Copy link

codecov bot commented Oct 5, 2021

Codecov Report

Merging #1109 (a58c617) into main (17d75a8) will decrease coverage by 0.18%.
The diff coverage is 98.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1109      +/-   ##
==========================================
- Coverage   90.68%   90.50%   -0.19%     
==========================================
  Files          65       66       +1     
  Lines       34587    34707     +120     
==========================================
+ Hits        31365    31410      +45     
- Misses       3222     3297      +75     
Impacted Files Coverage Δ
lightning/src/ln/functional_tests.rs 97.39% <ø> (-0.11%) ⬇️
lightning/src/ln/mod.rs 90.00% <ø> (ø)
lightning/src/ln/channelmanager.rs 84.88% <95.23%> (+<0.01%) ⬆️
lightning/src/ln/payment_tests.rs 98.75% <98.75%> (ø)
lightning/src/util/events.rs 31.74% <0.00%> (-1.25%) ⬇️
lightning-invoice/src/de.rs 80.94% <0.00%> (+0.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17d75a8...a58c617. Read the comment docs.

Copy link
Contributor

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Primarily nits around style.

}

#[test]
fn retry_on_init_fail() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test name doesn't seem to reflect what's happening in the test. How about expanding the test to reconnect the nodes and successfully send another payment? Then add another check showing the payment is being tracked. Could name the test tracks_pending_outbound_payment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just renamed it no_pending_leak_on_initial_send_failure, I'm not sure what reconnecting and sending does - the point is that you can't retry at that point, not sending a full payment.

@TheBlueMatt TheBlueMatt force-pushed the 2021-10-init-fail-payment-retry-leak branch from 34e2ad5 to f8b89a1 Compare October 7, 2021 19:27
If we attempt to send a payment, but the HTLC cannot be send due to
local channel limits, we'll provide the user an error but end up
with an entry in our pending payment map. This will result in a
memory leak as we'll never reclaim the pending payment map entry.
@TheBlueMatt TheBlueMatt force-pushed the 2021-10-init-fail-payment-retry-leak branch from f8b89a1 to a58c617 Compare October 7, 2021 22:28
@TheBlueMatt
Copy link
Collaborator Author

Squashed without changes, will land after CI:

$ git diff-tree -U1 f8b89a1b a58c617c
$

@TheBlueMatt TheBlueMatt merged commit 6582aae into lightningdevkit:main Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants